package cn.wolfcode.crm.qo;

import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Setter
@Getter
public class CustomerReportQueryObject extends QueryObject{
//    public static final int EMPLOYEE = 1;
//    public static final int year = 2;
//    public static final int month = 3;
//    public static final int day = 4;
    private String keyword;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDate;
    private String groupType = "e.name";//年  月  日  员工

    public String getGroups(){
        if(groupType!=null && "e.name".equals(groupType)){
            return "员工";
        }else if(groupType!=null && "DATE_FORMAT(c.input_time,'%Y')".equals(groupType)){
            return "年";
        }else if(groupType!=null && "DATE_FORMAT(c.input_time,'%Y-%m')".equals(groupType)){
            return "月";
        }else if(groupType!=null && "DATE_FORMAT(c.input_time,'%Y-%m-%d')".equals(groupType)){
            return "日";
        }else{
            return "未知";
        }
    }
}
